/*     */ package com.zimbra.qa.unittest.prov.ldap;
/*     */ 
/*     */ import com.zimbra.common.localconfig.DebugConfig;
/*     */ import com.zimbra.common.localconfig.KnownKey;
/*     */ import com.zimbra.common.util.CliUtil;
/*     */ import com.zimbra.common.util.Log;
/*     */ import com.zimbra.common.util.Log.Level;
/*     */ import com.zimbra.common.util.ZimbraLog;
/*     */ import com.zimbra.cs.account.accesscontrol.RightManager;
/*     */ import com.zimbra.cs.ldap.unboundid.InMemoryLdapServer;
/*     */ import com.zimbra.qa.unittest.prov.ProvTest;
/*     */ import java.io.PrintStream;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Date;
/*     */ import org.junit.Assert;
/*     */ import org.junit.BeforeClass;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class LdapTest
/*     */   extends ProvTest
/*     */ {
/*     */   private static final String LDAP_TEST_BASE_DOMAIN = "ldaptest";
/*     */   private static boolean perJVMInited;
/*     */   private static String useInMemoryLdapServerOverride;
/*     */   
/*     */   static
/*     */   {
/*  40 */     perJVMInited = false;
/*     */     
/*     */ 
/*     */ 
/*  44 */     useInMemoryLdapServerOverride = "true";
/*     */     
/*     */ 
/*     */ 
/*  48 */     boolean assertsEnabled = false;
/*  49 */     assert ((assertsEnabled = 1) != 0);
/*     */     
/*  51 */     if (!assertsEnabled) {
/*  52 */       throw new RuntimeException("Asserts must be enabled!!!");
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   static String baseDomainName()
/*     */   {
/*  62 */     StackTraceElement[] s = new RuntimeException().getStackTrace();
/*  63 */     return s[1].getClassName().toLowerCase() + "." + "ldaptest" + "." + "unittest";
/*     */   }
/*     */   
/*     */   public static String genTestId()
/*     */   {
/*  68 */     Date date = new Date();
/*  69 */     SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd-HHmmss");
/*  70 */     return fmt.format(date);
/*     */   }
/*     */   
/*     */   private static synchronized void initPerJVM() throws Exception
/*     */   {
/*  75 */     if (perJVMInited) {
/*  76 */       return;
/*     */     }
/*  78 */     perJVMInited = true;
/*     */     
/*  80 */     CliUtil.toolSetup(Log.Level.error.name());
/*  81 */     ZimbraLog.test.setLevel(Log.Level.info);
/*     */     
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*  88 */     if (useInMemoryLdapServerOverride != null) {
/*  89 */       boolean useInMemoryLdapServer = Boolean.parseBoolean(useInMemoryLdapServerOverride);
/*     */       
/*     */ 
/*  92 */       KnownKey key = new KnownKey("debug_use_in_memory_ldap_server", useInMemoryLdapServerOverride);
/*     */       
/*  94 */       if (DebugConfig.useInMemoryLdapServer != useInMemoryLdapServer) {
/*  95 */         System.out.println("useInMemoryLdapServerOverride is " + useInMemoryLdapServerOverride + " but LC key debug_use_in_memory_ldap_server is " + key.value() + ".  Remove the value from LC key.");
/*     */         
/*     */ 
/*  98 */         Assert.fail();
/*     */       }
/*     */     }
/* 101 */     ZimbraLog.test.info("useInMemoryLdapServer = " + InMemoryLdapServer.isOn());
/*     */     
/* 103 */     RightManager.getInstance(true);
/*     */     
/* 105 */     Cleanup.deleteAll(new String[0]);
/*     */   }
/*     */   
/*     */   @BeforeClass
/*     */   public static void beforeClass()
/*     */     throws Exception
/*     */   {}
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/prov/ldap/LdapTest.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */